package yhao.infra.feature.qiniu.oss.core.response;

import com.qiniu.http.Response;
import org.apache.commons.lang3.StringUtils;

/**
 * @author yoara
 * <p> Created on 2019/9/25 </p>
 */
public class QiniuBaseResponse {
    private Response response;

    private String responseBody;

    public QiniuBaseResponse(Response response) {
        this.response = response;
    }

    public QiniuBaseResponse(String responseBody) {
        this.responseBody = responseBody;
    }

    public String getResponseBody() {
        return responseBody;
    }

    public void setResponseBody(String responseBody) {
        this.responseBody = responseBody;
    }

    public Response getResponse() {
        return response;
    }

    public void setResponse(Response response) {
        this.response = response;
    }

    public boolean isSuccess(){
        if(response!=null){
            return response.isOK();
        }
        if(StringUtils.isNotBlank(responseBody)){
            return true;
        }
        return false;
    }
}
